package yunjiao.javatutorials.guava.concurrent;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;

/**
 * ForwardingLock
 *
 * @author yangyunjiao
 */
public abstract class ForwardingLock implements Lock {
    protected abstract Lock delegate();

    @Override
    public void lock() {
        delegate().lock();
    }

    @Override
    public void lockInterruptibly() throws InterruptedException {
        delegate().lockInterruptibly();
    }

    @Override
    public boolean tryLock() {
        return delegate().tryLock();
    }

    @Override
    public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
        return delegate().tryLock(time, unit);
    }

    @Override
    public void unlock() {
        delegate().unlock();
    }

    @Override
    public Condition newCondition() {
        return delegate().newCondition();
    }
}
